home *** CD-ROM | disk | FTP | other *** search
/ PC Answers 1998 January / PC Answers Issue 49 Cover CD January 1998.iso / Apps / Director / DATA.Z / Widget Wizard.dir / WidgtBehaviors_93_Prev Message Sprite .ls < prev    next >
Encoding:
Text File  |  1997-05-10  |  4.6 KB  |  133 lines

  1. property whichevent, TextSprite, button_active, downPrevCM, upPrevCM, disPrevCM, downPrevNum, upPrevNum, disPrevNum, totalCount, currentCount, nextButtonSprite, spriteNum
  2.  
  3. on getPropertyDescriptionList
  4.   set description to [:]
  5.   if the currentSpriteNum = 0 then
  6.     set updefault to 0
  7.     set downdefault to 0
  8.   else
  9.     set memref to the member of sprite the currentSpriteNum
  10.     set castLibNum to the castLibNum of memref
  11.     set downdefault to member (the memberNum of member memref + 1) of castLib castLibNum
  12.     set updefault to member (the memberNum of member memref + 2) of castLib castLibNum
  13.   end if
  14.   addProp(description, #TextSprite, [#comment: "Text Target Sprite:", #format: #integer, #default: the currentSpriteNum - 1])
  15.   addProp(description, #whichevent, [#comment: "Triggering Event:", #format: #symbol, #range: [#mouseUp, #mouseDown, #prepareFrame, #enterFrame, #exitFrame], #default: #mouseUp])
  16.   addProp(description, #downPrevCM, [#comment: "Down state of button: ", #format: #bitmap, #default: downdefault])
  17.   addProp(description, #upPrevCM, [#comment: "Up State of button: ", #format: #bitmap, #default: updefault])
  18.   addProp(description, #nextButtonSprite, [#comment: "What channel is Next Button: ", #format: #integer, #default: the currentSpriteNum + 1])
  19.   addProp(description, #totalCount, [#comment: "How many text fields: ", #format: #integer, #default: 1])
  20.   return description
  21. end
  22.  
  23. on getBehaviorDescription
  24.   return "Send a Message to the designated Sprite when the specified Event occurs.  At its destination the message will be interpreted as a sprite event and any actions defined for that event will be invoked." & RETURN & "PARAMETERS:" & RETURN & "ΓÇó Message - name of event to invoke at target sprite." & RETURN & "ΓÇó Target Sprite - number of sprite channel to which message should be sent." & RETURN & "ΓÇó Triggering Event - event that should cause message to be sent." & RETURN & "NOTES:" & RETURN & "If the target sprite does not handle the message it will propagate to the cast member script, the current frame script, and then the movie, in search of a handler for that event."
  25. end
  26.  
  27. on getAssocMembers
  28.   set myPropList to [downPrevCM, upPrevCM]
  29.   return myPropList
  30. end
  31.  
  32. on beginSprite me
  33.   set the disPrevNum of me to the member of sprite the spriteNum of me
  34.   set the disPrevCM of me to the member of sprite the spriteNum of me
  35.   set the upPrevNum of me to the number of member upPrevCM
  36.   set the downPrevNum of me to the number of member downPrevCM
  37.   set the disPrevNum of me to the number of member disPrevCM
  38.   set the button_active of me to 0
  39.   set the member of sprite the spriteNum of me to disPrevNum
  40.   set the currentCount of me to 1
  41. end
  42.  
  43. on endSprite me
  44.   puppetSprite(the spriteNum of me, 0)
  45. end
  46.  
  47. on triggerSendSprite me
  48.   trigger(me)
  49. end
  50.  
  51. on checkbutton me
  52.   set currentCount to the currentCount of sprite(the TextSprite of me)
  53.   if currentCount = 1 then
  54.     set the member of sprite the spriteNum of me to disPrevNum
  55.   else
  56.     set the member of sprite the spriteNum of me to upPrevNum
  57.   end if
  58. end
  59.  
  60. on mouseUp me
  61.   if the number of member the member of sprite the spriteNum of me = disPrevNum then
  62.     exit
  63.   end if
  64.   set the currentCount of me to the currentCount of me - 1
  65.   if the currentCount of me = 1 then
  66.     set the member of sprite the spriteNum of me to disPrevNum
  67.   else
  68.     set the member of sprite the spriteNum of me to upPrevNum
  69.   end if
  70.   set the button_active of me to 0
  71.   if whichevent = #mouseUp then
  72.     trigger(me)
  73.   end if
  74. end
  75.  
  76. on mouseDown me
  77.   if the number of member the member of sprite the spriteNum of me = disPrevNum then
  78.     exit
  79.   end if
  80.   set the member of sprite the spriteNum of me to downPrevNum
  81.   set the button_active of me to 1
  82.   if whichevent = #mouseDown then
  83.     trigger(me)
  84.   end if
  85. end
  86.  
  87. on mouseUpOutSide me
  88.   if the number of member the member of sprite the spriteNum of me = disPrevNum then
  89.     exit
  90.   end if
  91.   set the button_active of me to 0
  92. end
  93.  
  94. on mouseLeave me
  95.   if the number of member the member of sprite the spriteNum of me = disPrevNum then
  96.     exit
  97.   end if
  98.   if the button_active of me then
  99.     set the member of sprite the spriteNum of me to upPrevNum
  100.   end if
  101. end
  102.  
  103. on mouseEnter me
  104.   if the number of member the member of sprite the spriteNum of me = disPrevNum then
  105.     exit
  106.   end if
  107.   if the button_active of me then
  108.     set the member of sprite the spriteNum of me to downPrevNum
  109.   end if
  110. end
  111.  
  112. on prepareFrame me
  113.   if whichevent = #prepareFrame then
  114.     trigger(me)
  115.   end if
  116. end
  117.  
  118. on enterFrame me
  119.   if whichevent = #enterFrame then
  120.     trigger(me)
  121.   end if
  122. end
  123.  
  124. on exitFrame me
  125.   if whichevent = #exitFrame then
  126.     trigger(me)
  127.   end if
  128. end
  129.  
  130. on trigger me
  131.   sendSprite(the TextSprite of me, #reverseText)
  132. end
  133.